import { ApiManager } from '@hw-agconnect/api-ohos'
import agconnect from '@hw-agconnect/api-ohos'

import { InstanceMap } from '@hw-agconnect/core-ohos';
import { AGConnectFunctionImpl } from "./src/main/ets/Impl/AGConnectFunctionImpl";

export { AGCFunctionException } from "./src/main/ets/exception/AGCFunctionException";

const apiName = "function";

export const creator = new InstanceMap((args: any[]) => {
  return new AGConnectFunctionImpl(args[0]);
});

function main(container: ApiManager) {
  container.registerApiProvider(apiName, (args?: any[]) => creator.get(args));
}

main(agconnect as ApiManager);
